import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import routes from './routes'
import { useMainStore } from "/@/store";

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

router.beforeEach((toRoute, fromRoute, next) => {
  useMainStore().updateOpenedList({
    mode: 'add',
    route: toRoute,
  })

  next()
})

export default router
